/**
 *
    算法描述：纯模拟，直接对字符串进行模拟分析即可。碰到什么情况就做什么输出
    解决所需数据结构+算法：
**/
#include<iostream>
using namespace std;

int main() {
    int a = 0, b = 0, c = 0;
    string s;
    cin >> s;
    for(int i=0; i<s.length(); i++) {
        switch (s[i]) {
        case 'a':
            if(i<s.length()+3 && s[i+1]==':' && s[i+2]=='=')
                if(s[i+3]>='0' && s[i+3]<='9')
                    a = s[i+3] - '0';
                else if(s[i+3] == 'b')  a = b;
                else if(s[i+3] == 'c')  a = c;
            break;
        case 'b':
            if(i<s.length()+3 && s[i+1]==':' && s[i+2]=='=')
                if(s[i+3]>='0' && s[i+3]<='9')
                    b = s[i+3] - '0';
                else if(s[i+3] == 'a')  b = a;
                else if(s[i+3] == 'c')  b = c;
            break;
        case 'c':
            if(i<s.length()+3 && s[i+1]==':' && s[i+2]=='=')
                if(s[i+3]>='0' && s[i+3]<='9')
                    c = s[i+3] - '0';
                else if(s[i+3] == 'a')  c = a;
                else if(s[i+3] == 'b')  c = b;
            break;
        
        default:
            break;
        }
    }
    cout << a << " " << b << " " << c << endl;

    return 0;
}